package com.hy.mybatisplus.exception;

/**
 * 自定义异常
 * @author hy
 * @date 2020/09/29  9:30 AM
 */
public class CustomException extends RuntimeException {

    private static final long serialVersionUID = 4564124491192825748L;

    private int code;

    public CustomException() {
        super();
    }

    public CustomException(ErrorEnums enums) {
        super(enums.getErrorInfo());
        this.code = enums.getCode();
    }

    public CustomException(ErrorEnums enums, String msg) {
        super(msg);
        this.code = enums.getCode();
    }

    public CustomException(Throwable e) {
        super(e);
    }

    public CustomException(String message) {
        super(message);
    }

    public CustomException(int code, String message) {
        super(message);
        this.setCode(code);
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
}
